home *** CD-ROM | disk | FTP | other *** search
- UPDATE - Shareware Atari 520ST C compiler - version 1.2
- copyright 1987 - Mark A. Johnson
-
- This is an update to the shareware C compiler I've distributed in
- the past. It contains updates to the compiler, assembler, libraries and
- startup routines. It also contains a UN*X-style "make" program (mk.c)
- and a tool to help figure out crashes (bug.c). Read the source for info
- on how to use mk and bug. To save space, I've only included the source
- for the libaries and tools. Use the compiler to build them:
-
- cc -o lib.a lib.c
- cc -o gem.a gem.c
-
- cc mk.c
- as -o mk.ttp ttp.s yc.out -l lib.a
- cc bug.c
- as -o bug.ttp ttp.s yc.out -l lib.a
-
- This version fixes two bugs in the "register" storage class code generation.
- The previous update (version 1.1) had register variables in the library
- code which will not work. If you wish to continue to use 1.1 (instead of
- downloaded 1.2) you must delete the storage class "register" from the
- variable declarations in gem.c and lib.c and recompile the libraries.
- (I'd just downloading the update.)
-
- What follows is the original README.DOC included with the distribution disk,
- updated with recent changes. If you need the distribution disk, send me a
- blank disk at the address listed below. (Judged by the previous responses,
- shareware == freeware and hardly anyone writes to say thanks. That's okay,
- as long as we're all having fun).
-
- Mark A. Johnson
- 85 Coleman Avenue
- Red Bank, NJ 07701
-
- This disk contains a limited shareware C compiler for your use and enjoyment.
- You should find a number of directories on this disk which contain the
- following files:
-
- bin
- cc.ttp - translates C code to intermediate code
- as.ttp - translates intermediate code to machine code
- hd.ttp - hex dump utility
- cat.ttp - file concatenation utility
- grep.ttp - utility to search for a string in a file
- date.ttp - displays (sets) the current date and time
- ue.ttp - public domain microEmacs editor
- mk.ttp - simple UN*X style "make" program
- bug.ttp - answers the question "where did it crash"
-
- lib
- prg.s - startup intermediate code for .PRG programs
- ttp.s - startup intermediate code for .TTP programs
- lib.a - library used to create .TTP programs
- gem.a - library used to create .PRG programs
- lib.c - c code for lib.a
- gem.c - c code for gem.a
- stdio.h - standard i/o header
- setjmp.h - header for setjmp/longjmp routines
- gem.h - header for GEM AES routines
-
- src
- ss.c - source for a simple spreadsheet program
- cat.c - source the file concatenation program
- grep.c - source for the string search program
- hd.c - source for the hex dump program
- mk.c - source for the make program
- bug.c - source for the bug finder program
-
- You will also find the following files in the root directory:
-
- rmd209.acc - public domain ramdisk accessory
- command.tos - public domain command line interpreter
- boot.bat - copy tools into the ramdisk
- as.doc - documentation on the intermediate code
- err.doc - documentation on the compiler error messages
- readme.doc - this file
-
- The compiler (cc.ttp) is preprocessor, parser, and code generator all rolled
- into a single program. Please refer to the "C Programming Language" by K&R.
- The compiler has the following features, limitations, and shortcomings:
-
- features
- - symbol names can be any length
- - built-in "trap" generator "trap(NUM, arg1, arg2, ...)"
- - structure assignments
- - register variables
-
- limitations
- - Initialization should be done carefully. No type checking
- is done between the initializing value and the type of the variable
- being initialized. This is crude but it works. Accepted initializer
- values are (long or short) constant expressions, strings, and symbols.
- Local variables can be initialized with any valid expression.
-
- what's missing
- - type specifiers: float double auto
- - goto and labels
-
- The output of the compiler is ascii text and each line maps into a
- single instruction. This intermediate code is as terse as I can make it (to
- save disk space) but is still readable (by me at least). (I have plans to
- improve this to make things easier for an optimizer). The output of the
- compiler is always placed in a file called "yc.out" in the current directory.
- Any error messages are displayed on the screen. If "-o filename" is present
- on the command line, output will be placed in the specified file instead of
- YC.OUT.
-
- The assembler (as.ttp) reads the intermediate code in a single pass and
- keeps everything in memory before generating the file "ya.out" in the
- current directory. The size limit of the program to be compiled is basically
- the size of the available memory. The "ya.out" file should be renamed to
- one of the standard extensions (.TTP, .PRG, .TOS) before executing it.
- The command line of the assembler should always list a startup file
- first (see ttp.s or prg.s) then the intermediate files of the program,
- then "-L" followed by any libraries. Any errors encountered by the
- assembler terminates assembly. A "-m" argument to the assembler will
- include the symbol table (standard Atari format) in the output file.
- A "-o filename" argument will place the output in the specified file instead
- of in YA.OUT.
-
- A library is simply intermediate code, but is handled differently by the
- assembler than regular intermediate code. Intermediate code (the
- files before "-L") are read and processed directly; all symbols and
- code are accepted without question. A library is read without processing
- until a symbol is found that is needed but not defined. From that point
- on, the library is read and processed until the next symbol is encountered.
- At the next symbol, the "needed but not defined" test is applied again
- and processing or scanning continues as necessary.
-
- The libraries include TOS, VDI, and AES routines taken from the Abacus books.
- I plan to document the library routines later. I have also included basic
- <stdio.h> routines. I have included the source for lib.a and gem.a (see
- lib.c and gem.c). A lot of library routines you would expect to see are
- missing, and for that I apologize. I have recently added scanf, a full
- printf, and a real malloc/realloc/free memory allocator package to lib.c
-
- Creating .TTP programs is straightforward and better tested than .PRG (GEM)
- program creation. In a .TTP process, the main function is called with
- the standard arguments:
-
- main(argc, argv) int argc; char *argv[];
-
- Redirection of input and output using >outfile, >>appendfile, or <infile
- on the command line is handled by a startup routine linked into the
- compiled program. Reads and writes to the screen are built to map '\n'
- to/from "\n\r".
-
- Support for GEM programs (.PRG) is not completely debugged. The GEM.A
- library includes all the VDI and AES functions in the Abacus books,
- but has not been extensively tested. The VDI routines work and
- the window routines, form_alert, and evnt_multi of AES are working.
- My stumbling block right now is adequate documentation
- that would enable me to build a (working) Resource Construction Set.
- I'm working on it...
-
- Let me give you an example of how I use these tools. I make up an
- auto-booting disk from the distribution disk which contains all the files
- I normally use when compiling (as.ttp, cc.ttp, the libraries, starup files,
- and as many tools as can fit in the ramdisk). I use Moshe Braner's AUTODISK
- which sets the date and copies stuff to ramdisk very quickly. MK works
- best when the date is accurately set.
-
- I then insert a working disk (I only have a single floppy!).
- I use microEmacs (ue.ttp) to create or edit C programs. The MK.TTP program
- has built-in rules that enable it to build .TTP or .PRG programs out of
- .C source files without any makefile needed. For example,
-
- mk grep.ttp
-
- will compile the program grep.c and create an executable called grep.ttp.
- If the C program is contained in a number of files, I normally create a
- makefile MK.TTP can use. Intermediate files are created from the C source
- (again a built-in rule in MK.TTP) and finally the object is linked together
- by an entry in the makefile. For example, say I have a spreadsheet program
- composed of four files: main.c, io.c, calc.c, and display.c. The following
- makefile would do the trick (without the indentations!)
-
- # makefile for a (mythical) spreadsheet program
-
- OBJ = main.s io.s calc.s display.s
-
- ss.ttp: $(OBJ)
- d:as.ttp d:ttp.s $(OBJ) -L d:lib.a
-
- io.c main.c display.c: stdio.h
-
-
- With the above, I can build the spreadsheet after editing with
-
- mk ss.ttp
-
- Only those files that need to be compiled will be compiled. When everything
- is compiled then the objects will be linked together to form the executable.
- The source for MK.TTP is included on this disk (SRC\MK.C), so take a look in
- there for more information on how it works. If you insist on doing things by
- hand, then
-
- cc file.c
-
- will compile FILE.C into intermediate code, which is found in YC.OUT in the
- current directory. You then use
-
- as d:ttp.s yc.out -L d:lib.a
-
- to assemble and link the startup file TTP.S, the compiler output YC.OUT and
- the library LIB.A. For GEM programs, you can replace TTP.S with PRG.S
- and add GEM.A after the -L.
-
- I bought my 520ST in April 1986. Almost all the software I have is either
- public domain or shareware. I have supported the shareware idea in the past,
- but I'd like to see it happen for myself. If you like what you find here,
- please send a donation along with your name and address. I'd like to run a
- newsletter to discuss bugs, enhancements, and hints. There is a lot
- I would like to do with this in the future. Many of the limitations are
- easy to fix, and I really do need a Resource Construction Set (if I can
- only figure out how to make object trees that work!). I hope you enjoy
- this software. It is not for sale by anyone, and I reserve all rights
- to its ownership. Feel free to pass it on to other ST owners, but please
- pass on the whole disk, including this "readme" file. I welcome any comments
- you may have; send mail to:
-
- Mark A. Johnson
- 85 Coleman Ave
- Red Bank, NJ 07701
-
-